package com.heima.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.heima.domain.pojo.QcCheckItem;
import com.heima.mapper.CheckItemMapper;
import com.heima.service.CheckItemService;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

@Service
public class CheckItemServiceImpl extends ServiceImpl<CheckItemMapper, QcCheckItem> implements CheckItemService {

    @Override
    public IPage<QcCheckItem> queryPage(Page<QcCheckItem> page, String name) {
        LambdaQueryWrapper<QcCheckItem> queryWrapper = new LambdaQueryWrapper<>();
        // 按名称模糊查询
        if (StringUtils.hasText(name)) {
            queryWrapper.like(QcCheckItem::getName, name);
        }
        queryWrapper.orderByAsc(QcCheckItem::getId);
        return baseMapper.selectPage(page, queryWrapper);
    }


}
